package com.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

public class IODemo {
	public static void main(String[] args) throws IOException {
//		String pathname = "C:" + File.separator + "ttt.txt";
//		String s = readF(new File(pathname));
//		System.err.println(s);
//		
//		File file=new File("C:"+File.separator+"ttt2.txt");
//		if(!file.exists()){
//			file.createNewFile();
//		}
//		outPut(s, file);
		File file3=new File("C:"+File.separator+new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date())+".txt");
		if(!file3.exists()){
			file3.createNewFile();
		}
		
		PrintWriter printWriter=new PrintWriter(file3);
//		printWriter.write("112233");
	
		try {
			String s=null;
//			int l=s.length();
			int i[]=new int [10];
			int tt=i[11];
		} catch (Exception e) {
			e.printStackTrace(printWriter);
			printWriter.flush();
			
		}
		
		
	}

	static String readF(File file) throws IOException {
		InputStream in = new FileInputStream(file);
		byte b[] = new byte[(int) file.length()];
		in.read(b);
		return new String(b);

	}

	static void outPut(String s, File file) throws IOException {
		OutputStream out = new FileOutputStream(file);
		out.write(s.getBytes());

	}

}
